<?php

use Illuminate\Support\Facades\Schema;
use Illuminate\Database\Schema\Blueprint;
use Illuminate\Database\Migrations\Migration;

class CreateAdminsTable extends Migration
{
    /**
     * Run the migrations.
     *
     * @return void
     */
    public function up()
    {
        Schema::create('admins', function (Blueprint $table) {
            $table->bigIncrements('id');
            $table->string('user_name',50)->unique()->comment("管理员用户名");
            $table->string('email',100)->unique()->comment("管理员邮箱");
            $table->string('password',100)->comment("管理员密码");
            $table->string("phone",11)->unique()->comment("手机号码");
            $table->string("avatar",100)->nullable()->comment("头像");
            $table->string("real_name",20)->nullable()->comment("真实姓名");
            $table->string("nick_name",50)->nullable()->comment("昵称");
            $table->boolean("sex")->default(0)->comment("性别");

            $table->string("login_ip",20)->nullable()->comment("登录ip");
            $table->string("qq",20)->nullable()->comment("qq号码");

            $table->integer("login_count")->default(0)->comment("登录次数");
            $table->integer("login_error_count")->default(0)->comment("登录错误次数");

            $table->tinyInteger("status")->default(0)->comment("状态");
            $table->timestamp('email_verified_at')->nullable()->comment("邮箱验证");
            $table->rememberToken();
            $table->timestamps();
            $table->softDeletes();
        });
    }

    /**
     * Reverse the migrations.
     *
     * @return void
     */
    public function down()
    {
        Schema::dropIfExists('admins');
    }
}
